package com.red.star.wechat.data.mappers;

import com.red.star.wechat.data.core.base.MyMapper;
import com.red.star.wechat.data.entity.CustomerPushLog;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * @author nofish.yan@gmail.com
 * @date 2018/7/18.
 * 客户信息推送记录数据访问接口
 */
public interface CustomerPushLogMapper extends MyMapper<CustomerPushLog> {
    @Select(value = "select t.* from t_customer_push_log t where t.receiver_open_id=#{receiverOpenId} ORDER BY t.create_time desc LIMIT 1")
    CustomerPushLog getLogByOpenId(@Param("receiverOpenId") String receiverOpenId);
    @Select(value = "select COUNT(*) from t_customer_push_log where to_days(create_time) = to_days(now()) and receiver_open_id=#{receiverOpenId}")
    int countByCreateTime(@Param("receiverOpenId") String receiverOpenId);

}
